//
//  SCU_AlertHelper.m
//  XGL
//
//  Created by BC_design on 2017/5/7.
//  Copyright © 2017年 BlueChips. All rights reserved.
//

#import "LR_AlertHelper.h"
#import "LPPopup.h"





@interface LR_AlertHelper ()

@property (nonatomic,strong) LPPopup *popUp;

@end

@implementation LR_AlertHelper
+ (instancetype)sharedInstance
{
    static id sharedSingleton = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedSingleton = [[self alloc] init];
    });
    return sharedSingleton;
}

+(void)showMessage:(NSString *)Str
{
    dispatch_async(dispatch_get_main_queue(), ^{
        [self showPopupMessage:Str toView:nil];
    });
}


/*
 提示内容
 按钮文字
 按钮事件
 */
+(void)showButtonMessage:(NSString *)Str
          andButtonTitle:(NSString *)title
                andBlock:(AlertHelperBlock)block
{

}


/*
 提示内容
 第一个按钮的文字
 第一个按钮的点击事件
 第二个按钮的文字
 第二个按钮的点击事件
 */
+(void)showDoubleButtonMessage:(NSString *)Str
                andButtonTitle:(NSString *)title
                      andBlock:(AlertHelperBlock)block
              atherButtonTitle:(NSString *)otherTitle
                      andBlock:(AlertHelperBlock)otherBlock
{

}



+ (void)showPopupMessage:(NSString *)message toView:(UIView *)view {
    if (view == nil) {
       
        view = LRSharedApp.window;
    }

    LR_AlertHelper *help=[LR_AlertHelper sharedInstance];

    if (help.popUp) {
        [help.popUp removeFromSuperview];
        help.popUp = nil;
    }

    help.popUp = [LPPopup popupWithText:message];
    [help.popUp showInView:view centerAtPoint:LRSharedApp.window.center duration:kLPPopupDefaultWaitDuration completion:nil];
}

@end
